package com.lzq.model.singleton;

/**
 * @author : modify
 * @version : v1.0
 * @description :
 * @createTime : 2022/11/13 16:26
 * @updateUser : modify
 * @updateTime : 2022/11/13 16:26
 * @updateRemark : 饿汉式
 */
public class HungryStyleVar {

    /**
     * 静态成员变量
     */
    private static HungryStyleVar hungryStyleVar = new HungryStyleVar();

    private HungryStyleVar() {
    }

    public static HungryStyleVar getInstance() {
        return hungryStyleVar;
    }
}

class Test {
    public static void main(String[] args) {
        HungryStyleVar instance = HungryStyleVar.getInstance();
        HungryStyleVar instance1 = HungryStyleVar.getInstance();
        System.out.println(instance == instance1);
    }
}